﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAL;

namespace LINQ_Example
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Model m=null;
            bool flag = false;

            if (rbLocalConn.Checked)
            {
               m = new Model();
               flag = true;
            }
            else if(rbSqlConn.Checked)
            {
               m = new Model(Program.ConnectionString);
               flag = true;
            }
            else
            {
                errorProvider1.SetError(button1, "Select an connection please.");
            }

            if (flag)
            {
                errorProvider1.Clear();
                this.dataGridView1.DataSource = m.GetClientes(txbParam.Text);
            }
           
        }

        private void txbParam_KeyPress(object sender, KeyPressEventArgs e)
        {

        }

        
    }
}
